package edu.gdkm.dao;

import edu.gdkm.pojo.StudentInfo;
import org.apache.ibatis.annotations.*;
import java.util.List;

public interface StudentInfoDAO {
    /**
     * 新增学生信息
     * @param studentInfo 学生信息对象
     * @return 是否成功
     */
    @Insert("INSERT INTO student_info(user_id, real_name, gender, birthday, id_card, university, major, education, graduation_time, political_status, hometown, current_city, job_intention, job_type, salary_expectation, self_introduction, create_time, update_time) " +
            "VALUES(#{userId}, #{realName}, #{gender}, #{birthday}, #{idCard}, #{university}, #{major}, #{education}, #{graduationTime}, #{politicalStatus}, #{hometown}, #{currentCity}, #{jobIntention}, #{jobType}, #{salaryExpectation}, #{selfIntroduction}, #{createTime}, #{updateTime})")
    boolean insert(StudentInfo studentInfo);
    
    /**
     * 根据ID删除学生信息
     * @param id 学生信息ID
     * @return 是否成功
     */
    @Delete("DELETE FROM student_info WHERE id = #{id}")
    boolean deleteById(Long id);
    
    /**
     * 更新学生信息
     * @param studentInfo 学生信息对象
     * @return 是否成功
     */
    @Update("UPDATE student_info SET user_id = #{userId}, real_name = #{realName}, gender = #{gender}, birthday = #{birthday}, id_card = #{idCard}, university = #{university}, major = #{major}, education = #{education}, graduation_time = #{graduationTime}, political_status = #{politicalStatus}, hometown = #{hometown}, current_city = #{currentCity}, job_intention = #{jobIntention}, job_type = #{jobType}, salary_expectation = #{salaryExpectation}, self_introduction = #{selfIntroduction}, update_time = #{updateTime} WHERE id = #{id}")
    boolean update(StudentInfo studentInfo);
    
    /**
     * 根据ID查询学生信息
     * @param id 学生信息ID
     * @return 学生信息对象
     */
    @Select("SELECT * FROM student_info WHERE id = #{id}")
    StudentInfo selectById(Long id);
    
    /**
     * 查询所有学生信息
     * @return 学生信息列表
     */
    @Select("SELECT * FROM student_info")
    List<StudentInfo> selectAll();
    
    /**
     * 根据用户ID查询学生信息
     * @param userId 用户ID
     * @return 学生信息对象
     */
    @Select("SELECT * FROM student_info WHERE user_id = #{userId}")
    StudentInfo selectByUserId(Long userId);
    
    /**
     * 根据真实姓名查询学生信息
     * @param realName 真实姓名
     * @return 学生信息列表
     */
    @Select("SELECT * FROM student_info WHERE real_name = #{realName}")
    List<StudentInfo> selectByRealName(String realName);
}
